package solved;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

/*
ID:		liluyan1
LANG:	JAVA
TASK:	ratios
*/
public class ratios {
	public static void main(String[] args) throws IOException {
		BufferedReader f = new BufferedReader(new FileReader("ratios.in"));
		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(
				"ratios.out")));
		new ratios().solve(f, out);
		out.close();
		System.exit(0);
	}
	
	private void solve(BufferedReader f, PrintWriter out) throws IOException {
		int[][] r = new int[3][3];
		int[] goal = read(f, 3);
		for (int i=0; i<3; i++) {
			r[i] = read(f, 3);
		}

		int MAX = 100;
		
		for (int total=1; total<=3*MAX; total++) {
			for (int i=0; i<=total; i++) {
				for (int j=0; j<=total-i; j++) {
					int k = total - i - j;
					if (match(i, j, k, r, goal)) {
						out.print(i + " " + j + " " + k + " ");
						out.println((i*r[0][0] + j*r[1][0] + k*r[2][0])/goal[0]);
						return;
					}
				}
			}
		}
		
		out.println("NONE");
	}
	
	private boolean match(int i, int j, int k, int[][] r, int[] goal) {
		int a = i*r[0][0] + j*r[1][0] + k*r[2][0];
		int b = i*r[0][1] + j*r[1][1] + k*r[2][1];
		int c = i*r[0][2] + j*r[1][2] + k*r[2][2];
		if ((a+b+c) % (goal[0]+goal[1]+goal[2]) != 0) return false;
		
		int ratio = (a+b+c) / (goal[0]+goal[1]+goal[2]);
		return goal[0]*ratio==a && goal[1]*ratio==b && goal[2]*ratio==c;
	}
	
	public int read(BufferedReader f) throws IOException {
		return Integer.parseInt(f.readLine());
	}
	
	public int[] read(BufferedReader f, int N) throws IOException {
		String[] t = f.readLine().split(" ");
		int[] a = new int[N];
		for (int i=0; i<N; i++) {
			a[i] = Integer.parseInt(t[i]);
		}
		return a;
	}
}
